package com.caeit.service.bigscreen.impl

import com.caeit.model.bigscreen.BigscreenConfig
import com.caeit.service.bigscreen.BigscreenConfigService
import com.caeit.service.bigscreen.dto.BigscreenConfigQuery
import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.data.domain.PageRequest
import org.springframework.security.test.context.support.WithUserDetails
import org.springframework.test.context.junit.jupiter.SpringExtension


@SpringBootTest
@ExtendWith(SpringExtension::class)
internal class BigscreenConfigServiceImplTest {

    @Autowired
    lateinit var bigscreenConfigService: BigscreenConfigService

    @Test
    fun paginQuery() {
        var query = BigscreenConfigQuery()
        query.setName("测试")
        val result = bigscreenConfigService.paginQuery(query, PageRequest.of(1, 10))

        assertNotNull(result)
    }

    @Test
    fun queryById() {
    }

    @Test
    @WithUserDetails
    fun save() {
        val bigscreenConfig = BigscreenConfig()
        bigscreenConfig.category = 0
        bigscreenConfig.name = "大屏测试"
        bigscreenConfig.mainJson = "{'aaa': 'bbb'}"
        bigscreenConfig.status = 0

        bigscreenConfigService.save(bigscreenConfig)

        val findAll = bigscreenConfigService.findAll()

    }

    @Test
    fun deleteById() {
    }

    @Test
    fun findAll() {
    }
}